#pragma once

#include "stdafx.h"
#include "ETHFram.h"


class CPacketQueue
{
public:
	CPacketQueue();
	virtual ~CPacketQueue();

	BOOL Initial();
	BOOL Exit();

	BOOL AddPacket(CETHFram*Packet);
	CETHFram *DeletePacket();

	static DWORD WINAPI ThreadFunc(LPVOID arg);
	
private:
	std::list<CETHFram*> mPacketQueue;
#if 0//_MSC_PLATFORM_TOOLSET > 100
	std::thread *mThread;
	std::mutex mQueueLock;
#else
	CRITICAL_SECTION mQueueLock;
	HANDLE mThread;
#endif
	HANDLE mQueueEvent;
	BOOL mAlive;
};

